package com.yand.controller.business.product;


import com.github.pagehelper.PageInfo;
import com.yand.api.entity.business.product.THfProductDetail;
import com.yand.api.entity.system.TSysUser;
import com.yand.api.service.business.ProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;


/**
 *  产品明细相关controller
 */
@Api(tags = "产品明细")
@RestController
@RequestMapping("product")
public class ProductController {

    @Autowired
    private ProductService productService;

    @ApiOperation("跳转产品明细列表页")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "product", value = "产品明细", required = true)
    })
    @GetMapping("/detailed")
    public ModelAndView list(THfProductDetail productDetail, Model model){
        ModelAndView modelAndView = new  ModelAndView();

        modelAndView.setViewName("business/product/product-detail-list");
        PageInfo<THfProductDetail> productDetailPageInfo = productService.queryAllProductList(productDetail);
        model.addAttribute("pageInfo",productDetailPageInfo);

        model.addAttribute("productDetail",productDetail);

        return modelAndView;
    }

}
